package com.wuhunyu.controller;


import com.wuhunyu.commonutils.query.CommonQuery;
import com.wuhunyu.commonutils.result.CommonResult;
import com.wuhunyu.entities.CrmBanner;
import com.wuhunyu.service.CrmBannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 首页banner表 前端控制器 for 管理员
 * </p>
 *
 * @author wuhunyu
 * @since 2021-01-22
 */
@RestController
@RequestMapping("/crmBanner/admin")
//@CrossOrigin
public class BannerAdminController {

    @Autowired
    private CrmBannerService crmBannerService;

    @PostMapping("/selectAllBanners")
    public CommonResult selectAllBanners(@RequestBody(required = false) CommonQuery commonQuery) {
        return crmBannerService.selectAllBanners(commonQuery);
    }

    @PostMapping("/addBanner")
    public CommonResult addBanner(@RequestBody(required = false) CrmBanner crmBanner) {
        return crmBannerService.addBanner(crmBanner);
    }

    @PutMapping("/updateBanner")
    public CommonResult updateBanner(@RequestBody(required = false) CrmBanner crmBanner) {
        return crmBannerService.updateBanner(crmBanner);
    }

    @DeleteMapping("/deleteBanner/{id}")
    public CommonResult deleteBanner(@PathVariable("id") String id) {
        return crmBannerService.deleteBanner(id);
    }

}

